﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompositeModeStudy
{
    public class Composite : Component
    {
        List<Component> components = new List<Component>();

        public override void print()
        {
            Console.WriteLine("print " + title);
            foreach (Component cp in components)
            {
                cp.print();
            }
        }

        public void add(Component cp)
        {
            components.Add(cp);
        }
    }
}
